package com.atguigu.algorithm;

import java.util.Scanner;

public class DataPool {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        while(scanner.hasNextInt()){
            int n=scanner.nextInt();
            String[] strings=new String[n];
            strings[0]=scanner.nextLine();
            for(int i=0;i<n;i++){
                strings[i]=scanner.nextLine();
            }
            int max=Integer.MIN_VALUE;
            int res=0;
            for(int i=0;i<n;i++){
                if(strings[i].contains("disconnect")){
                    res--;
                }else{
                    res++;
                    if(max<res){
                        max=res;
                    }
                }
            }
            System.out.println(max);
        }
    }
}
